package com.itheima.mapper;

import com.itheima.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {
    @Select("select * from user where phone=#{phone}")
    User findByPhone(String phone);

    //    @Insert("insert into user(phone,status) values(#{phone},#{status})")
//    void addByPhone(User dbuser);
    @Insert("insert into user(phone,status) values(#{phone},#{status})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    void save(User dbUser);

    @Select("select * from user where id=#{userId}")
    User findById(long userId);
}
